package com.cskaoyan.controller;

import com.cskaoyan.service.StatisticalStatementsService;
import com.cskaoyan.vo.BaseRespVo;
import com.cskaoyan.vo.GoodsStatVO;

import com.cskaoyan.vo.OrderStatVO;

import com.cskaoyan.vo.UserStatVO;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("admin")
@RequiresRoles("超级管理员")
public class StatisticalStatementsController {

    @Autowired
    StatisticalStatementsService statisticalStatementsService;

    @GetMapping("stat/order")
    public BaseRespVo statOrder(){
        OrderStatVO orderStatVO = statisticalStatementsService.getOrderStat();
        return BaseRespVo.ok(orderStatVO);

    }

    @GetMapping("stat/user")
    public BaseRespVo statUser(){
        UserStatVO userStatVO = statisticalStatementsService.getUserStat();
        return BaseRespVo.ok(userStatVO);
    }


    @GetMapping("stat/goods")
    public BaseRespVo getGoodsStat() {
        GoodsStatVO goodsStatVO = statisticalStatementsService.getGoodsStat();
        return BaseRespVo.ok(goodsStatVO);
    }
}
